#ifndef __TRANSLATE_H__
#define __TRANSLATE_H__

#include "intercode.h"
#include "treenode.h"
#include "map.h"
#include "array.h"

typedef struct _argsList{
    operand t;
    struct _argsList* next;
} argsList;

argsList* newArgsList(operand t);
argsList* insertArgsList(argsList* args, argsList* newArg);

void translateError(int tsErrType);
bool isNull(operand t);
bool cmpop(treenode* node, const char* op);
operand getVar(const char* name);
interCode* tsProgram(treenode* node);
interCode* tsExtDefList(treenode* node);
void tsSpecifier(treenode* node);
interCode* tsExtDef(treenode* node);
interCode* tsFunDec(treenode *node);
interCode* tsVarList(treenode* node);
interCode* tsParamDec(treenode* node);
interCode* tsFuncVarDec(treenode* node);
interCode* tsCompSt(treenode* node);
interCode* tsDefList(treenode* node);
interCode* tsDef(treenode* node);
interCode* tsDecList(treenode *node);
interCode* tsDec(treenode* node);
interCode* tsVarDec(treenode* node, treenode* exp);
operand tsArray(treenode* node, interCode** code1, interCode** code2, int *dimRecord, arrayTs** aa);
interCode* tsExp(treenode* node, operand place);
interCode* tsArgs(treenode* node, argsList** args);
interCode* tsCond(treenode* node, int labelt, int labelf);
interCode* tsStmtList(treenode* node);
interCode* tsStmt(treenode* node);
void translate(FILE* fp, treenode* node);



#endif